import request from 'UTIL/request'

/**
 * 发票列表
 * @param params
 */
export function GetList(params) {
  return request({
    url: 'crmInvoice/queryPageList',
    method: 'POST',
    data: params
  })
}

/**
 * 发票详情
 * @param params
 */
export function QueryById(params) {
  return request({
    url: `crmInvoice/queryById/${params.invoiceId}`,
    method: 'POST',
    data: params
  })
}

/**
 * 基本信息
 */
export function InformationById(params) {
  return request({
    url: `crmInvoice/information/${params.id}`,
    method: 'POST',
    data: params
  })
}

/**
 * 新增/编辑时查询字段
 */
export function QueryFieldList(params) {
  const query = params && params.id ? `/${params.id}` : ''
  return request({
    url: `crmInvoice/field${query}`,
    method: 'POST',
    data: params,
		requestType: 'form'
  })
}

/**
 * 发票创建
 */
export function AddInvoice(params) {
  return request({
    url: 'crmInvoice/add',
    method: 'POST',
    data: params
  })
}

/**
 * 发票编辑
 */
export function UpdateInvoice(params) {
  return request({
    url: 'crmInvoice/update',
    method: 'POST',
    data: params
  })
}

/**
 * 发票删除
 * @param params
 */
export function DeleteByIds(params) {
  return request({
    url: 'crmInvoice/deleteByIds',
    method: 'POST',
    data: params
  })
}

/**
 * 发票转移
 * @param params
 */
export function ChangeOwnerUser(params) {
  return request({
    url: 'crmInvoice/changeOwnerUser',
    method: 'POST',
    data: params
  })
}

/**
 * 查询发票下附件列表
 * @param params
 */
export function QueryFileList(params) {
  return request({
    url: 'crmInvoice/queryFileList',
    method: 'POST',
    data: params,
		header: {
			'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
		}
  })
}

/**
 * 重置开票信息
 * @param params
 */
export function ResetInvoiceStatus(params) {
  return request({
    url: 'crmInvoice/resetInvoiceStatus',
    method: 'POST',
    data: params
  })
}

/**
 * 标注已开发票
 * @param params
 */
export function UpdateInvoiceStatus(params) {
  return request({
    url: 'crmInvoice/updateInvoiceStatus',
    method: 'POST',
    data: params
  })
}